<?php
/*=============================================================================
|| ##################################################################
||	phpFoX Konsort
|| ##################################################################
||
||	Copyright		: (C) 2005-2007 PHPFOX Limited a Reality Fox Creation
||	Contact			: info@phpfox.com
||
||	- phpFoX and all of its source code and files are protected by Copyright Laws.
||
||	- The license for phpFoX permits you to install this software on a single domain (.com, .org, .net, etc.).
||
||	- You may also not remove this copyright screen which shows the copyright information and credits for phpFoX (RealityFOX Creations).
||
||	- phpFoX Konsort is NOT a FREE software - http://www.phpfox.com/license/
||
|| ##################################################################
=============================================================================*/

/* $File: ./include/modules/Account/classes/PhpFox_ComponentTopUsers.class.php, $Author:  $ */



/** Top users component
 *
 * @version $Id: PhpFox_ComponentTopUsers.class.php 326 2008-02-14 11:11:31Z phpfoxsv $
 * @package module.account
 *
 */
class PhpFox_Mod_Account_ComponentTopUsers extends BaseComponent
{
    function process()
    {
        $oTpl = &$this->_oModule->getTemplate();

        $iNumUsers = $this->getParam('iNumUsers', 50);
        $oReq = &App::getRequest();
        $sGender = $oReq->get('user', 'male');

        $oSrvAcc = $this->_oModule->getService('Account');
        /* @var $oSrvAcc PhpFox_Mod_Account_ServiceAccount */

        $aGenders = App::getOptions('gender');

		$aGenderId = $this->oDatabase->getField("SELECT varid FROM ". App::getT('language_options') ."
			WHERE `varname` = 'gender' AND `default` = '". ($sGender == 'male' ? 'Male' : 'Female') ."' AND languageid = '1'");

        $aTopUsers = $oSrvAcc->getTopUsers($aGenderId, $iNumUsers, array('user', 'user_rating'));

        $oTpl->assign(array(
            'aTopUsers'   => $aTopUsers,
            'sUserPicUrl' => App::getParam('user.pic.url'),
            'sGender'     => strtoupper(App::format("core.". $sGender ."")),
        ));
        return $oTpl->fetch('TopUsers.html');
    }
}
?>